package com.alibaba.hsf.guide.router;

import com.alibaba.middleware.hsf.guide.api.common.StopGuard;
import com.alibaba.middleware.hsf.guide.api.service.OrderService;

import com.taobao.hsf.app.api.util.HSFApiConsumerBean;

/**
 * @author weipeng2k 2018年05月18日 下午16:41:56
 */
public class OddStart {

    public static void main(String[] args) {
        System.setProperty("project.name", "HSF-Guide-Client-Normal");
        System.setProperty("com.alibaba.middleware.hsf.guide.watch.port", String.valueOf(12307));
        HSFApiConsumerBean hsfApiConsumerBean = new HSFApiConsumerBean();
        hsfApiConsumerBean.setInterfaceName("com.alibaba.middleware.hsf.guide.api.service.OrderService");
        hsfApiConsumerBean.setVersion("1.0.0");
        hsfApiConsumerBean.setGroup("HSF");
        hsfApiConsumerBean.setClientTimeout(100);
        try {
            hsfApiConsumerBean.init(10000);
            final OrderService orderService = (OrderService) hsfApiConsumerBean.getObject();
            System.out.println("odd normal client start.");

            StopGuard.run(new Runnable() {
                @Override
                public void run() {
                    for (int i = 1; i < 5; i++) {
                        orderService.queryOrder((long)i);
                    }
                }
            });


        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

}
